<strong></strong><template>
	<view class="page">
		<view class="pageBg">
			<image src="https://bjsx.gzwhir.com/admin-api/infra/file/18/get/memberbg2.png" mode="widthFix"></image>
		</view>
		<view class="flex0">
			<u-navbar :fixed='false' bgColor="transparent" @leftClick="navBack" title="在线查看报告">
				<view slot="center" class="navTitle">
					我的测评
				</view>
			</u-navbar>
		</view>
		<view class="flex1">
			<scroll-view scroll-y="true" class="scrollView pt30">
				<view class="pd30">
					<view class="viewComplete">
						<view class="tp" v-if="info.status">
							<view class="i">
								<text>完成日期</text>
								<text style="padding-left: 10rpx;">{{info.createTimeFormat}}</text>
							</view>
							<view class="gp">
								<image src="@/static/images/tabgap.png" mode="scaleToFill"></image>
							</view>
							<view class="i">
								<text>答题时长</text>
								<text style="padding-left: 10rpx;">{{info.answerTime}}</text>
							</view>
						</view>
						<view class="content" v-if="info.evaluationTask">
							<view class="tit">
								{{info.evaluationTask.name}}
							</view>
							<view class="desc" v-html="info.evaluationTask.description"></view>
							<view class="btns" v-if="info.status">
								<view class="btn" @tap="viewReport(info.id)">
									查看报告
								</view>
							</view>
						</view>
					</view>
					<view class="testList s2" v-if="info.questionList&&info.questionList.length>0">
						<view class="item" v-for="i in info.questionList">
							<view class="img">
								<image :src="i.picUrl" mode="aspectFill"></image>
							</view>
							<view class="txt">
								<view class="it">
									{{i.name}}
								</view>
								<view class="ip">
									{{i.description}}
								</view>
								<view class="btns">
									<view class="btn"  v-if="i.isFinish">
										已完成
									</view>
									<view v-else class="btn on" @click="toTest(i)">
										开始测评
									</view>
								</view>
							</view>

						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				testId: '',
				info: ''
			}
		},
		methods: {
			toTest(item){
				if(item.isFinish){
					return
				}
				
					uni.redirectTo({
						url: `/subpage/test/projectDetail?id=${item.id}&evaluationId=${this.info.evaluationId}`
					})
			},
			viewReport(id) {
				var that = this;
				uni.navigateTo({
					url:'/subpage/report/report?id=' + id
				})
				return
				switch (that.utype) {
					case 'student': {
						uni.navigateTo({
							url: '/subpage/student/report/report?id=' + id
						});
						break;
					};
					case 'teacher': {
						uni.navigateTo({
							url: '/subpage/teacher/report/report?id=' + id
						});
						break;
					};
					case 'patriarch': {
						uni.navigateTo({
							url: '/subpage/patriarch/report/report?id=' + id
						});
						break;
					};
				}

			},
			getInfo() {
				var that = this;
				if (!that.testId) {
					return
				};


				that.$api.reportInfo({
					id: that.testId
				}, res => {
					if (res.code == 200) {
						that.info = res.data
					}
				})
		}
	},
	onLoad(e) {
		this.testId = e.id
		this.getInfo();
		this.utype = 'patriarch'
	}
	}
</script>

<style lang="scss" scoped>
	.testList {
		&.s2 {
			.item {
				padding: 20rpx;

				&:nth-child(3n+1) {
					background: linear-gradient(90deg, #fff, #e3eefa);
				}

				&:nth-child(3n+2) {
					background: linear-gradient(90deg, #fff, #ffecde);
				}

				&:nth-child(3n+3) {
					background: linear-gradient(90deg, #fff, #def1ed);
				}

				&:last-child {
					margin-bottom: 0;
				}

				.img {
					width: 160rpx;
					height: 160rpx;
				}

				.it {
					color: #4d5765;
				}

				.ip {
					color: #7a7e89;
				}

				.btns {
					display: flex;
					align-items: center;
					justify-content: flex-start;
					margin-top: 30rpx;

					.btn {
						width: 140rpx;
						font-size: 24rpx;
						line-height: 60rpx;
						border-radius: 60rpx;
						text-align: center;
						color: #fe9c29;
						background: #fff;
					}
				}
			}
		}
	}

	.pb50 {
		padding-bottom: 50rpx;
	}

	.viewComplete {
		border-radius: 30rpx;
		overflow: hidden;
		margin-bottom: 20rpx;
		background: #fff;

		.tp {
			background: #ffebd4;
			display: flex;
			align-items: stretch;
			justify-content: space-between;
			color: #fe9c29;

			.i {
				flex: 0 0 auto;
				padding: 0 20rpx;
				line-height: 60rpx;
				font-size: 24rpx;
			}

			.gp {
				flex: 1 1 auto;

				image {
					display: block;
					height: 60rpx;
					width: 100%;
				}
			}
		}

		.content {
			padding: 30rpx;

			.tit {
				padding: 30rpx 0;
				text-align: center;
				font-size: 48rpx;
				font-weight: bold;
				color: #65554d;
			}

			.desc {
				color: #897f7a;
				font-size: 28rpx;
				line-height: 1.3;
			}
		}

		.btns {
			margin-top: 50rpx;

			.btn {
				text-align: center;
				line-height: 90rpx;
				height: 90rpx;
				outline: none !important;
				background: #fe9c29;
				color: #fff;
				border: none;
				border-radius: 90rpx;
				overflow: hidden;
				margin-bottom: 20rpx;
				font-size: 28rpx;

				&:before,
				&:after {
					display: none;
				}

				&.gray {
					background: #e1ebf8;
					color: #4d5765;
				}
			}
		}
	}
</style>